1 {\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf120
2 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Menlo-Regular;}
3 {\colortbl;\red255\green255\blue255;}
4 \margl1440\margr1440\vieww25580\viewh24980\viewkind0
6 \pard\pardeftab720\partightenfactor0
8 \f0\fs24 \cf0 \expnd0\expndtw0\kerning0
9 Three steps to attach, and debug in Xcode, a /usr/sbin/mDNSResponder that is already running. One caveat, mDNSResponder has to be built and deployed (using step 1 and 2 below) before it can be attached to Xcode.\
11 1.) First you have to build the Xcode project with symbols included and optimizations off.\
13 a.) From Terminal shell, open mDNSResponder Xcode project from top of tree: \'a0\
15 $ open mDNSMacOSX/mDNSResponder.xcodeproj/\
17 \pard\pardeftab720\partightenfactor0
18 \cf0 You can also just double click on the project from Finder.\
20 b.) Add your diffs to mDNSResponder project.
22 \pard\pardeftab720\partightenfactor0
25 c.) Set Strip Linked Product to No and compiler Optimization Level to None. Below shows changed settings.\
27 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
28 \cf0 \kerning1\expnd0\expndtw0 {{\NeXTGraphic Screen Shot 2015-09-16 at 3.36.23 PM.png \width7680 \height460
31 {{\NeXTGraphic Screen Shot 2015-09-16 at 3.46.14 PM.png \width8700 \height460
32 }¬}\expnd0\expndtw0\kerning0
34 \pard\pardeftab720\partightenfactor0
36 d. ) Build mDNSResponder by setting the target to mDNSResponder.\
38 {{\NeXTGraphic unknown.png \width4300 \height800 \noorient
41 Then execute\'a0Command-B to build.\
44 2.) Next, deploy newly-created Xcode version.\
46 a.) Go to Terminal shell and type the following: sudo mv \
48 b.) Then drag mDNSResponder from Products list on left side panel (shown below using red arrow) to Terminal shell.\
50 \pard\pardeftab720\partightenfactor0
51 \cf0 {{\NeXTGraphic 52D711AF-4055-4867-A494-7E31552BB9E1.png \width4420 \height9700
52 }¬}\pard\pardeftab720\partightenfactor0
59 $ sudo mv\'a0/Volumes/iMac\\ HD/Users/llaier/Library/Developer/Xcode/DerivedData/mDNSResponder-fktewmdupxbxrrdlsdljyhmihboz/Build/Products/mDNSResponder\'a0/usr/sbin/mDNSResponder\
61 d.) Restart mDNSResponder by executing the following:\
63 $ sudo killall mDNSResponder\
64 \pard\pardeftab720\partightenfactor0
68 \pard\pardeftab720\partightenfactor0
70 \f0\fs24 \cf0 3.) In Xcode, select Debug > Attach to Process > mDNSResponder.
74 Now set a breakpoint and try to trigger it.\